package com.zx._12_算法.剑指offer._2022;

/**
 * https://leetcode.cn/problems/biao-shi-shu-zhi-de-zi-fu-chuan-lcof/
 */
public class 表示数值的字符串 {

    public boolean isNumber(String s) {
        if (s == null || s.length() == 0) {
            return false;
        }
        s = s.trim();
        try {
            double a = Double.parseDouble(s);
        } catch (Exception e) {
            return false;
        }

        char c = s.charAt(s.length() - 1);
        //特，末尾有f，d,D这些不算，但是3.算数字
        return (c >= '0' && c <= '9') || c == '.';
    }
}
